<%@ page import="sige.Contrato" %>
<%@ page import="sige.Aluno" %>

<div class="control-group">
    <label  class="control-label" for="nomeDoAluno" >
        <g:message code="aluno.nome.label" default="Nome do Aluno" />
    </label>
    <div class="controls" >
        <g:field type="text" name="alunoDoContrato" readonly="readonly" 
            value="${contratoInstance?.aluno?.nome}" class="span4" />
    </div>
</div>

<div class="control-group" >
	 <label  class="control-label" for="dataDaMatricula">
		<g:message code="contrato.dataDaMatricula.label" default="Data Da Matricula" />
		<span class="required-indicator">*</span>
	</label> 
 	 <div class="controls"> 
	<g:myDatePicker name="dataDaMatricula" precision="day"  value="${contratoInstance?.dataDaMatricula}"  />
	 </div> 
 </div>

<div class="control-group">
    <label  class="control-label" for="AnoLetivo">
    <g:message code="anoLetivo.label" default="Ano Letivo" />
    <span class="required-indicator">*</span>
    </label>
    <div class="controls" >
    <g:select id="AnoLetivo" from="${sige.AnoLetivo.abertos()}"
	      optionValue="ano" optionKey="id" name="ano.id"
              required="" noSelection="['':'Escolha um ano']"
              onchange="${remoteFunction( action: 'updateTurmas',
                       update: 'turmas',
                       params: '\'id=\' + this.value')}">
    </g:select>
    </div>
</div>

<div class="control-group" id="turmas" >
    <label  class="control-label" for="turma">
        <g:message code="turma.label" default="Turma" />
        <span class="required-indicator">*</span>
    </label>
</div>

<div class="control-group">
    <label  class="control-label" for="dataDeVencimento" >
        <g:message code="anuidade.mesBase.label" default="Mês Base" />
    </label>
    <div class="controls" >
        <g:if test="${!contratoInstance?.id}">
            <g:myDatePicker id="dataDeVencimento" name="dataDeVencimento" precision="month"
                            value="${contratoInstance?.anuidade?.dataDeVencimento}" />
        </g:if>
        <g:else>
            <g:textField class="span2" name="dataDeVencimento" readonly="readonly" 
                value="${formatDate(format: 'MM/yyyy' , date: contratoInstance?.anuidade?.dataDeVencimento) } "
                />
        </g:else>
    </div>
</div>

<div class="control-group">
    <label  class="control-label" for="responsavel.cadastrar">
    <g:message code="responsavel.cadastrar.label" default="Cadastrar Responsável" />
    <span class="required-indicator">*</span>
    </label>
    <div class="controls" >
    <g:select id="responsavel.cadastrar" name="ano.id" class="span4"
        from="${['Responsável Cadastrado - digitar CPF' , 'Cadastrar Responsável Depois' ]}"
        keys="${[1 , 2]}" required="" noSelection="['':' - ']"
        onchange="${remoteFunction( action: 'opcaoResp',
                       update: 'opcaoResponsavel',
                       params: '\'op=\' + this.value')}">
    </g:select>
    </div>
</div>

<div id="opcaoResponsavel"> </div>

<g:hiddenField  id="aluno" name="aluno.id" optionKey="id" required="" value="${contratoInstance?.aluno?.id}"/>
